home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / PAGE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  87 lines

  1. /*
  2.  * Definitions for page handling
  3.  *
  4.  * This file is subject to the terms and conditions of the GNU General Public
  5.  * License.  See the file "COPYING" in the main directory of this archive
  6.  * for more details.
  7.  *
  8.  * Copyright (C) 1994, 1995, 1996 by Ralf Baechle
  9.  */
  10. #ifndef __ASM_MIPS_PAGE_H
  11. #define __ASM_MIPS_PAGE_H
  12.  
  13. /* PAGE_SHIFT determines the page size */
  14. #define PAGE_SHIFT    12
  15. #define PAGE_SIZE    (1UL << PAGE_SHIFT)
  16. #define PAGE_MASK    (~(PAGE_SIZE-1))
  17.  
  18. #ifdef __KERNEL__
  19.  
  20. #define STRICT_MM_TYPECHECKS
  21.  
  22. #ifndef __LANGUAGE_ASSEMBLY__
  23.  
  24. #define get_user_page(vaddr)        __get_free_page(GFP_KERNEL)
  25. #define free_user_page(page, addr)    free_page(addr)
  26. extern void (*clear_page)(unsigned long page);
  27. extern void (*copy_page)(unsigned long to, unsigned long from);
  28.  
  29. #ifdef STRICT_MM_TYPECHECKS
  30. /*
  31.  * These are used to make use of C type-checking..
  32.  */
  33. typedef struct { unsigned long pte; } pte_t;
  34. typedef struct { unsigned long pmd; } pmd_t;
  35. typedef struct { unsigned long pgd; } pgd_t;
  36. typedef struct { unsigned long pgprot; } pgprot_t;
  37.  
  38. #define pte_val(x)    ((x).pte)
  39. #define pmd_val(x)    ((x).pmd)
  40. #define pgd_val(x)    ((x).pgd)
  41. #define pgprot_val(x)    ((x).pgprot)
  42.  
  43. #define __pte(x)    ((pte_t) { (x) } )
  44. #define __pme(x)    ((pme_t) { (x) } )
  45. #define __pgd(x)    ((pgd_t) { (x) } )
  46. #define __pgprot(x)    ((pgprot_t) { (x) } )
  47.  
  48. #else /* !defined (STRICT_MM_TYPECHECKS) */
  49. /*
  50.  * .. while these make it easier on the compiler
  51.  */
  52. typedef unsigned long pte_t;
  53. typedef unsigned long pmd_t;
  54. typedef unsigned long pgd_t;
  55. typedef unsigned long pgprot_t;
  56.  
  57. #define pte_val(x)    (x)
  58. #define pmd_val(x)    (x)
  59. #define pgd_val(x)    (x)
  60. #define pgprot_val(x)    (x)
  61.  
  62. #define __pte(x)    (x)
  63. #define __pmd(x)    (x)
  64. #define __pgd(x)    (x)
  65. #define __pgprot(x)    (x)
  66.  
  67. #endif /* !defined (STRICT_MM_TYPECHECKS) */
  68.  
  69. #endif /* __LANGUAGE_ASSEMBLY__ */
  70.  
  71. /* to align the pointer to the (next) page boundary */
  72. #define PAGE_ALIGN(addr)    (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  73.  
  74. /*
  75.  * This handles the memory map.
  76.  * We handle pages at KSEG0 for kernels with 32 bit address space.
  77.  */
  78. #define PAGE_OFFSET    0x80000000UL
  79. #define __pa(x)        ((unsigned long) (x) - PAGE_OFFSET)
  80. #define __va(x)        ((void *)((unsigned long) (x) + PAGE_OFFSET))
  81. #define MAP_MASK        0x1fffffffUL
  82. #define MAP_NR(addr)    ((((unsigned long)(addr)) & MAP_MASK) >> PAGE_SHIFT)
  83.  
  84. #endif /* defined (__KERNEL__) */
  85.  
  86. #endif /* __ASM_MIPS_PAGE_H */
  87.